package com.edu.ssm.service.impl;

import com.edu.ssm.domain.Emp;
import com.edu.ssm.mapper.EmpMapper;
import com.edu.ssm.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("empService")
public class EmpServiceImpl implements EmpService {
    @Autowired
    EmpMapper empMapper;

    @Override
    public List<Emp> queryEmps() {
        return empMapper.queryEmp();
    }

    @Transactional
    @Override
    public boolean addEmps(Emp emp) {
        boolean b1 = empMapper.addEmp(emp);
        System.out.println("第一次插入：" + b1);
//        System.out.println(10 / 0);
        Emp emp2 = new Emp(1006, "赵敏", "财务经理");
        boolean b2 = empMapper.addEmp(emp2);
        System.out.println("第二次插入：" + b2);
        return false;
    }
}
